﻿using XBMCRemote.DataModel.Entities;

namespace XBMCRemote.DataModel.Xbmc
{
    /// <summary>
    /// Class for all the input events.
    /// </summary>
    public class Input
    {
        private JsonRpcClient _client;

        /// <summary>
        /// Create input class and assign the <c>JsonRpcClient</c>.
        /// </summary>
        /// <param name="client">The client which handles the events.</param>
        public Input(JsonRpcClient client)
        {
            _client = client;
        }

        /// <summary>
        /// Navigate up in GUI
        /// </summary>
        public void Up()
        {
            _client.SendKeyCode(KeyCode.Up);
        }

        /// <summary>
        /// Navigate down in GUI
        /// </summary>
        public void Down()
        {
            _client.SendKeyCode(KeyCode.Down);            
        }

        /// <summary>
        /// Navigate right in GUI
        /// </summary>
        public void Right()
        {
            _client.SendKeyCode(KeyCode.Right);        
        }

        /// <summary>
        /// Navigate left in GUI
        /// </summary>
        public void Left()
        {
            _client.SendKeyCode(KeyCode.Left);           
        }

        /// <summary>
        /// Select current item in GUI.
        /// </summary>
        public void Select()
        {
            _client.SendKeyCode(KeyCode.Ok);
        }

        /// <summary>
        /// Goes to home window in GUI.
        /// </summary>
        public void Home()
        {
            _client.SendKeyCode(KeyCode.Home);          
        }

        /// <summary>
        /// Goes back in GUI.
        /// </summary>
        public void Back()
        {
            _client.SendKeyCode(KeyCode.Back);         
        }

        /// <summary>
        /// Opens the OSD when playing an item.
        /// </summary>
        public void OSD()
        {
            _client.SendActionCode(ActionCode.OSD);
        }

        /// <summary>
        /// Opens the Context Menu.
        /// </summary>
        public void ContextMenu()
        {
            _client.SendActionCode(ActionCode.ContextMenu);
        }
    }
}
